//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_spi(SotoInternal) import SotoCore

extension ConnectCampaigns {
    // MARK: Enums

    public enum CampaignState: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        /// Campaign is in failed state
        case failed = "Failed"
        /// Campaign is in initialized state
        case initialized = "Initialized"
        /// Campaign is in paused state
        case paused = "Paused"
        /// Campaign is in running state
        case running = "Running"
        /// Campaign is in stopped state
        case stopped = "Stopped"
        public var description: String { return self.rawValue }
    }

    public enum EncryptionType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case kms = "KMS"
        public var description: String { return self.rawValue }
    }

    public enum FailureCode: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        /// The request failed to satisfy the constraints specified by the service
        case invalidInput = "InvalidInput"
        /// Request throttled due to large number of pending dial requests
        case requestThrottled = "RequestThrottled"
        /// Unexpected error during processing of request
        case unknownError = "UnknownError"
        public var description: String { return self.rawValue }
    }

    public enum GetCampaignStateBatchFailureCode: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        /// The specified resource was not found
        case resourceNotFound = "ResourceNotFound"
        /// Unexpected error during processing of request
        case unknownError = "UnknownError"
        public var description: String { return self.rawValue }
    }

    public enum InstanceIdFilterOperator: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        /// Equals operator
        case eq = "Eq"
        public var description: String { return self.rawValue }
    }

    public enum InstanceOnboardingJobFailureCode: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case eventBridgeAccessDenied = "EVENT_BRIDGE_ACCESS_DENIED"
        case eventBridgeManagedRuleLimitExceeded = "EVENT_BRIDGE_MANAGED_RULE_LIMIT_EXCEEDED"
        case iamAccessDenied = "IAM_ACCESS_DENIED"
        case internalFailure = "INTERNAL_FAILURE"
        case kmsAccessDenied = "KMS_ACCESS_DENIED"
        case kmsKeyNotFound = "KMS_KEY_NOT_FOUND"
        public var description: String { return self.rawValue }
    }

    public enum InstanceOnboardingJobStatusCode: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case failed = "FAILED"
        case inProgress = "IN_PROGRESS"
        case succeeded = "SUCCEEDED"
        public var description: String { return self.rawValue }
    }

    public enum DialerConfig: AWSEncodableShape & AWSDecodableShape, Sendable {
        case agentlessDialerConfig(AgentlessDialerConfig)
        case predictiveDialerConfig(PredictiveDialerConfig)
        case progressiveDialerConfig(ProgressiveDialerConfig)

        public init(from decoder: Decoder) throws {
            let container = try decoder.container(keyedBy: CodingKeys.self)
            guard container.allKeys.count == 1, let key = container.allKeys.first else {
                let context = DecodingError.Context(
                    codingPath: container.codingPath,
                    debugDescription: "Expected exactly one key, but got \(container.allKeys.count)"
                )
                throw DecodingError.dataCorrupted(context)
            }
            switch key {
            case .agentlessDialerConfig:
                let value = try container.decode(AgentlessDialerConfig.self, forKey: .agentlessDialerConfig)
                self = .agentlessDialerConfig(value)
            case .predictiveDialerConfig:
                let value = try container.decode(PredictiveDialerConfig.self, forKey: .predictiveDialerConfig)
                self = .predictiveDialerConfig(value)
            case .progressiveDialerConfig:
                let value = try container.decode(ProgressiveDialerConfig.self, forKey: .progressiveDialerConfig)
                self = .progressiveDialerConfig(value)
            }
        }

        public func encode(to encoder: Encoder) throws {
            var container = encoder.container(keyedBy: CodingKeys.self)
            switch self {
            case .agentlessDialerConfig(let value):
                try container.encode(value, forKey: .agentlessDialerConfig)
            case .predictiveDialerConfig(let value):
                try container.encode(value, forKey: .predictiveDialerConfig)
            case .progressiveDialerConfig(let value):
                try container.encode(value, forKey: .progressiveDialerConfig)
            }
        }

        public func validate(name: String) throws {
            switch self {
            case .agentlessDialerConfig(let value):
                try value.validate(name: "\(name).agentlessDialerConfig")
            case .predictiveDialerConfig(let value):
                try value.validate(name: "\(name).predictiveDialerConfig")
            case .progressiveDialerConfig(let value):
                try value.validate(name: "\(name).progressiveDialerConfig")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case agentlessDialerConfig = "agentlessDialerConfig"
            case predictiveDialerConfig = "predictiveDialerConfig"
            case progressiveDialerConfig = "progressiveDialerConfig"
        }
    }

    // MARK: Shapes

    public struct AccessDeniedException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct AgentlessDialerConfig: AWSEncodableShape & AWSDecodableShape {
        public let dialingCapacity: Double?

        @inlinable
        public init(dialingCapacity: Double? = nil) {
            self.dialingCapacity = dialingCapacity
        }

        public func validate(name: String) throws {
            try self.validate(self.dialingCapacity, name: "dialingCapacity", parent: name, max: 1.0)
            try self.validate(self.dialingCapacity, name: "dialingCapacity", parent: name, min: 0.01)
        }

        private enum CodingKeys: String, CodingKey {
            case dialingCapacity = "dialingCapacity"
        }
    }

    public struct AnswerMachineDetectionConfig: AWSEncodableShape & AWSDecodableShape {
        /// Enable or disable await answer machine prompt
        public let awaitAnswerMachinePrompt: Bool?
        /// Enable or disable answering machine detection
        public let enableAnswerMachineDetection: Bool

        @inlinable
        public init(awaitAnswerMachinePrompt: Bool? = nil, enableAnswerMachineDetection: Bool) {
            self.awaitAnswerMachinePrompt = awaitAnswerMachinePrompt
            self.enableAnswerMachineDetection = enableAnswerMachineDetection
        }

        private enum CodingKeys: String, CodingKey {
            case awaitAnswerMachinePrompt = "awaitAnswerMachinePrompt"
            case enableAnswerMachineDetection = "enableAnswerMachineDetection"
        }
    }

    public struct Campaign: AWSDecodableShape {
        public let arn: String
        public let connectInstanceId: String
        public let dialerConfig: DialerConfig
        public let id: String
        public let name: String
        public let outboundCallConfig: OutboundCallConfig
        public let tags: [String: String]?

        @inlinable
        public init(arn: String, connectInstanceId: String, dialerConfig: DialerConfig, id: String, name: String, outboundCallConfig: OutboundCallConfig, tags: [String: String]? = nil) {
            self.arn = arn
            self.connectInstanceId = connectInstanceId
            self.dialerConfig = dialerConfig
            self.id = id
            self.name = name
            self.outboundCallConfig = outboundCallConfig
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case arn = "arn"
            case connectInstanceId = "connectInstanceId"
            case dialerConfig = "dialerConfig"
            case id = "id"
            case name = "name"
            case outboundCallConfig = "outboundCallConfig"
            case tags = "tags"
        }
    }

    public struct CampaignFilters: AWSEncodableShape {
        public let instanceIdFilter: InstanceIdFilter?

        @inlinable
        public init(instanceIdFilter: InstanceIdFilter? = nil) {
            self.instanceIdFilter = instanceIdFilter
        }

        public func validate(name: String) throws {
            try self.instanceIdFilter?.validate(name: "\(name).instanceIdFilter")
        }

        private enum CodingKeys: String, CodingKey {
            case instanceIdFilter = "instanceIdFilter"
        }
    }

    public struct CampaignSummary: AWSDecodableShape {
        public let arn: String
        public let connectInstanceId: String
        public let id: String
        public let name: String

        @inlinable
        public init(arn: String, connectInstanceId: String, id: String, name: String) {
            self.arn = arn
            self.connectInstanceId = connectInstanceId
            self.id = id
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case arn = "arn"
            case connectInstanceId = "connectInstanceId"
            case id = "id"
            case name = "name"
        }
    }

    public struct ConflictException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct CreateCampaignRequest: AWSEncodableShape {
        public let connectInstanceId: String
        public let dialerConfig: DialerConfig
        public let name: String
        public let outboundCallConfig: OutboundCallConfig
        public let tags: [String: String]?

        @inlinable
        public init(connectInstanceId: String, dialerConfig: DialerConfig, name: String, outboundCallConfig: OutboundCallConfig, tags: [String: String]? = nil) {
            self.connectInstanceId = connectInstanceId
            self.dialerConfig = dialerConfig
            self.name = name
            self.outboundCallConfig = outboundCallConfig
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, max: 256)
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
            try self.dialerConfig.validate(name: "\(name).dialerConfig")
            try self.validate(self.name, name: "name", parent: name, max: 127)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.outboundCallConfig.validate(name: "\(name).outboundCallConfig")
            try self.tags?.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^(?!aws:)[a-zA-Z+-=._:/]+$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
            }
        }

        private enum CodingKeys: String, CodingKey {
            case connectInstanceId = "connectInstanceId"
            case dialerConfig = "dialerConfig"
            case name = "name"
            case outboundCallConfig = "outboundCallConfig"
            case tags = "tags"
        }
    }

    public struct CreateCampaignResponse: AWSDecodableShape {
        public let arn: String?
        public let id: String?
        public let tags: [String: String]?

        @inlinable
        public init(arn: String? = nil, id: String? = nil, tags: [String: String]? = nil) {
            self.arn = arn
            self.id = id
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case arn = "arn"
            case id = "id"
            case tags = "tags"
        }
    }

    public struct DeleteCampaignRequest: AWSEncodableShape {
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DeleteConnectInstanceConfigRequest: AWSEncodableShape {
        public let connectInstanceId: String

        @inlinable
        public init(connectInstanceId: String) {
            self.connectInstanceId = connectInstanceId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.connectInstanceId, key: "connectInstanceId")
        }

        public func validate(name: String) throws {
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, max: 256)
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DeleteInstanceOnboardingJobRequest: AWSEncodableShape {
        public let connectInstanceId: String

        @inlinable
        public init(connectInstanceId: String) {
            self.connectInstanceId = connectInstanceId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.connectInstanceId, key: "connectInstanceId")
        }

        public func validate(name: String) throws {
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, max: 256)
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeCampaignRequest: AWSEncodableShape {
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeCampaignResponse: AWSDecodableShape {
        public let campaign: Campaign?

        @inlinable
        public init(campaign: Campaign? = nil) {
            self.campaign = campaign
        }

        private enum CodingKeys: String, CodingKey {
            case campaign = "campaign"
        }
    }

    public struct DialRequest: AWSEncodableShape {
        public let attributes: [String: String]
        public let clientToken: String
        @CustomCoding<ISO8601DateCoder>
        public var expirationTime: Date
        public let phoneNumber: String

        @inlinable
        public init(attributes: [String: String], clientToken: String, expirationTime: Date, phoneNumber: String) {
            self.attributes = attributes
            self.clientToken = clientToken
            self.expirationTime = expirationTime
            self.phoneNumber = phoneNumber
        }

        public func validate(name: String) throws {
            try self.attributes.forEach {
                try validate($0.key, name: "attributes.key", parent: name, max: 32767)
                try validate($0.key, name: "attributes.key", parent: name, pattern: "^[a-zA-Z0-9\\-_]+$")
                try validate($0.value, name: "attributes[\"\($0.key)\"]", parent: name, max: 32767)
                try validate($0.value, name: "attributes[\"\($0.key)\"]", parent: name, pattern: "^.*$")
            }
            try self.validate(self.clientToken, name: "clientToken", parent: name, max: 200)
            try self.validate(self.clientToken, name: "clientToken", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, max: 20)
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, pattern: "^[\\d\\-+]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case attributes = "attributes"
            case clientToken = "clientToken"
            case expirationTime = "expirationTime"
            case phoneNumber = "phoneNumber"
        }
    }

    public struct EncryptionConfig: AWSEncodableShape & AWSDecodableShape {
        public let enabled: Bool
        public let encryptionType: EncryptionType?
        public let keyArn: String?

        @inlinable
        public init(enabled: Bool, encryptionType: EncryptionType? = nil, keyArn: String? = nil) {
            self.enabled = enabled
            self.encryptionType = encryptionType
            self.keyArn = keyArn
        }

        public func validate(name: String) throws {
            try self.validate(self.keyArn, name: "keyArn", parent: name, max: 500)
        }

        private enum CodingKeys: String, CodingKey {
            case enabled = "enabled"
            case encryptionType = "encryptionType"
            case keyArn = "keyArn"
        }
    }

    public struct FailedCampaignStateResponse: AWSDecodableShape {
        public let campaignId: String?
        public let failureCode: GetCampaignStateBatchFailureCode?

        @inlinable
        public init(campaignId: String? = nil, failureCode: GetCampaignStateBatchFailureCode? = nil) {
            self.campaignId = campaignId
            self.failureCode = failureCode
        }

        private enum CodingKeys: String, CodingKey {
            case campaignId = "campaignId"
            case failureCode = "failureCode"
        }
    }

    public struct FailedRequest: AWSDecodableShape {
        public let clientToken: String?
        public let failureCode: FailureCode?
        public let id: String?

        @inlinable
        public init(clientToken: String? = nil, failureCode: FailureCode? = nil, id: String? = nil) {
            self.clientToken = clientToken
            self.failureCode = failureCode
            self.id = id
        }

        private enum CodingKeys: String, CodingKey {
            case clientToken = "clientToken"
            case failureCode = "failureCode"
            case id = "id"
        }
    }

    public struct GetCampaignStateBatchRequest: AWSEncodableShape {
        public let campaignIds: [String]

        @inlinable
        public init(campaignIds: [String]) {
            self.campaignIds = campaignIds
        }

        public func validate(name: String) throws {
            try self.campaignIds.forEach {
                try validate($0, name: "campaignIds[]", parent: name, max: 256)
                try validate($0, name: "campaignIds[]", parent: name, pattern: "^[\\S]*$")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case campaignIds = "campaignIds"
        }
    }

    public struct GetCampaignStateBatchResponse: AWSDecodableShape {
        public let failedRequests: [FailedCampaignStateResponse]?
        public let successfulRequests: [SuccessfulCampaignStateResponse]?

        @inlinable
        public init(failedRequests: [FailedCampaignStateResponse]? = nil, successfulRequests: [SuccessfulCampaignStateResponse]? = nil) {
            self.failedRequests = failedRequests
            self.successfulRequests = successfulRequests
        }

        private enum CodingKeys: String, CodingKey {
            case failedRequests = "failedRequests"
            case successfulRequests = "successfulRequests"
        }
    }

    public struct GetCampaignStateRequest: AWSEncodableShape {
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetCampaignStateResponse: AWSDecodableShape {
        public let state: CampaignState?

        @inlinable
        public init(state: CampaignState? = nil) {
            self.state = state
        }

        private enum CodingKeys: String, CodingKey {
            case state = "state"
        }
    }

    public struct GetConnectInstanceConfigRequest: AWSEncodableShape {
        public let connectInstanceId: String

        @inlinable
        public init(connectInstanceId: String) {
            self.connectInstanceId = connectInstanceId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.connectInstanceId, key: "connectInstanceId")
        }

        public func validate(name: String) throws {
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, max: 256)
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetConnectInstanceConfigResponse: AWSDecodableShape {
        public let connectInstanceConfig: InstanceConfig?

        @inlinable
        public init(connectInstanceConfig: InstanceConfig? = nil) {
            self.connectInstanceConfig = connectInstanceConfig
        }

        private enum CodingKeys: String, CodingKey {
            case connectInstanceConfig = "connectInstanceConfig"
        }
    }

    public struct GetInstanceOnboardingJobStatusRequest: AWSEncodableShape {
        public let connectInstanceId: String

        @inlinable
        public init(connectInstanceId: String) {
            self.connectInstanceId = connectInstanceId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.connectInstanceId, key: "connectInstanceId")
        }

        public func validate(name: String) throws {
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, max: 256)
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetInstanceOnboardingJobStatusResponse: AWSDecodableShape {
        public let connectInstanceOnboardingJobStatus: InstanceOnboardingJobStatus?

        @inlinable
        public init(connectInstanceOnboardingJobStatus: InstanceOnboardingJobStatus? = nil) {
            self.connectInstanceOnboardingJobStatus = connectInstanceOnboardingJobStatus
        }

        private enum CodingKeys: String, CodingKey {
            case connectInstanceOnboardingJobStatus = "connectInstanceOnboardingJobStatus"
        }
    }

    public struct InstanceConfig: AWSDecodableShape {
        public let connectInstanceId: String
        public let encryptionConfig: EncryptionConfig
        public let serviceLinkedRoleArn: String

        @inlinable
        public init(connectInstanceId: String, encryptionConfig: EncryptionConfig, serviceLinkedRoleArn: String) {
            self.connectInstanceId = connectInstanceId
            self.encryptionConfig = encryptionConfig
            self.serviceLinkedRoleArn = serviceLinkedRoleArn
        }

        private enum CodingKeys: String, CodingKey {
            case connectInstanceId = "connectInstanceId"
            case encryptionConfig = "encryptionConfig"
            case serviceLinkedRoleArn = "serviceLinkedRoleArn"
        }
    }

    public struct InstanceIdFilter: AWSEncodableShape {
        public let `operator`: InstanceIdFilterOperator
        public let value: String

        @inlinable
        public init(operator: InstanceIdFilterOperator, value: String) {
            self.`operator` = `operator`
            self.value = value
        }

        public func validate(name: String) throws {
            try self.validate(self.value, name: "value", parent: name, max: 256)
            try self.validate(self.value, name: "value", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case `operator` = "operator"
            case value = "value"
        }
    }

    public struct InstanceOnboardingJobStatus: AWSDecodableShape {
        public let connectInstanceId: String
        public let failureCode: InstanceOnboardingJobFailureCode?
        public let status: InstanceOnboardingJobStatusCode

        @inlinable
        public init(connectInstanceId: String, failureCode: InstanceOnboardingJobFailureCode? = nil, status: InstanceOnboardingJobStatusCode) {
            self.connectInstanceId = connectInstanceId
            self.failureCode = failureCode
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case connectInstanceId = "connectInstanceId"
            case failureCode = "failureCode"
            case status = "status"
        }
    }

    public struct InternalServerException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct InvalidCampaignStateException: AWSErrorShape {
        public let message: String
        public let state: CampaignState
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, state: CampaignState, xAmzErrorType: String? = nil) {
            self.message = message
            self.state = state
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.state = try container.decode(CampaignState.self, forKey: .state)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
            case state = "state"
        }
    }

    public struct InvalidStateException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct ListCampaignsRequest: AWSEncodableShape {
        public let filters: CampaignFilters?
        public let maxResults: Int?
        public let nextToken: String?

        @inlinable
        public init(filters: CampaignFilters? = nil, maxResults: Int? = nil, nextToken: String? = nil) {
            self.filters = filters
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.filters?.validate(name: "\(name).filters")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 50)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
        }

        private enum CodingKeys: String, CodingKey {
            case filters = "filters"
            case maxResults = "maxResults"
            case nextToken = "nextToken"
        }
    }

    public struct ListCampaignsResponse: AWSDecodableShape {
        public let campaignSummaryList: [CampaignSummary]?
        public let nextToken: String?

        @inlinable
        public init(campaignSummaryList: [CampaignSummary]? = nil, nextToken: String? = nil) {
            self.campaignSummaryList = campaignSummaryList
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case campaignSummaryList = "campaignSummaryList"
            case nextToken = "nextToken"
        }
    }

    public struct ListTagsForResourceRequest: AWSEncodableShape {
        public let arn: String

        @inlinable
        public init(arn: String) {
            self.arn = arn
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.arn, key: "arn")
        }

        public func validate(name: String) throws {
            try self.validate(self.arn, name: "arn", parent: name, max: 500)
            try self.validate(self.arn, name: "arn", parent: name, min: 20)
            try self.validate(self.arn, name: "arn", parent: name, pattern: "^arn:.*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListTagsForResourceResponse: AWSDecodableShape {
        public let tags: [String: String]?

        @inlinable
        public init(tags: [String: String]? = nil) {
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case tags = "tags"
        }
    }

    public struct OutboundCallConfig: AWSEncodableShape & AWSDecodableShape {
        public let answerMachineDetectionConfig: AnswerMachineDetectionConfig?
        public let connectContactFlowId: String
        public let connectQueueId: String?
        public let connectSourcePhoneNumber: String?

        @inlinable
        public init(answerMachineDetectionConfig: AnswerMachineDetectionConfig? = nil, connectContactFlowId: String, connectQueueId: String? = nil, connectSourcePhoneNumber: String? = nil) {
            self.answerMachineDetectionConfig = answerMachineDetectionConfig
            self.connectContactFlowId = connectContactFlowId
            self.connectQueueId = connectQueueId
            self.connectSourcePhoneNumber = connectSourcePhoneNumber
        }

        public func validate(name: String) throws {
            try self.validate(self.connectContactFlowId, name: "connectContactFlowId", parent: name, max: 500)
            try self.validate(self.connectQueueId, name: "connectQueueId", parent: name, max: 500)
            try self.validate(self.connectSourcePhoneNumber, name: "connectSourcePhoneNumber", parent: name, max: 100)
        }

        private enum CodingKeys: String, CodingKey {
            case answerMachineDetectionConfig = "answerMachineDetectionConfig"
            case connectContactFlowId = "connectContactFlowId"
            case connectQueueId = "connectQueueId"
            case connectSourcePhoneNumber = "connectSourcePhoneNumber"
        }
    }

    public struct PauseCampaignRequest: AWSEncodableShape {
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct PredictiveDialerConfig: AWSEncodableShape & AWSDecodableShape {
        public let bandwidthAllocation: Double
        public let dialingCapacity: Double?

        @inlinable
        public init(bandwidthAllocation: Double, dialingCapacity: Double? = nil) {
            self.bandwidthAllocation = bandwidthAllocation
            self.dialingCapacity = dialingCapacity
        }

        public func validate(name: String) throws {
            try self.validate(self.bandwidthAllocation, name: "bandwidthAllocation", parent: name, max: 1.0)
            try self.validate(self.bandwidthAllocation, name: "bandwidthAllocation", parent: name, min: 0.0)
            try self.validate(self.dialingCapacity, name: "dialingCapacity", parent: name, max: 1.0)
            try self.validate(self.dialingCapacity, name: "dialingCapacity", parent: name, min: 0.01)
        }

        private enum CodingKeys: String, CodingKey {
            case bandwidthAllocation = "bandwidthAllocation"
            case dialingCapacity = "dialingCapacity"
        }
    }

    public struct ProgressiveDialerConfig: AWSEncodableShape & AWSDecodableShape {
        public let bandwidthAllocation: Double
        public let dialingCapacity: Double?

        @inlinable
        public init(bandwidthAllocation: Double, dialingCapacity: Double? = nil) {
            self.bandwidthAllocation = bandwidthAllocation
            self.dialingCapacity = dialingCapacity
        }

        public func validate(name: String) throws {
            try self.validate(self.bandwidthAllocation, name: "bandwidthAllocation", parent: name, max: 1.0)
            try self.validate(self.bandwidthAllocation, name: "bandwidthAllocation", parent: name, min: 0.0)
            try self.validate(self.dialingCapacity, name: "dialingCapacity", parent: name, max: 1.0)
            try self.validate(self.dialingCapacity, name: "dialingCapacity", parent: name, min: 0.01)
        }

        private enum CodingKeys: String, CodingKey {
            case bandwidthAllocation = "bandwidthAllocation"
            case dialingCapacity = "dialingCapacity"
        }
    }

    public struct PutDialRequestBatchRequest: AWSEncodableShape {
        public let dialRequests: [DialRequest]
        public let id: String

        @inlinable
        public init(dialRequests: [DialRequest], id: String) {
            self.dialRequests = dialRequests
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            try container.encode(self.dialRequests, forKey: .dialRequests)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.dialRequests.forEach {
                try $0.validate(name: "\(name).dialRequests[]")
            }
            try self.validate(self.dialRequests, name: "dialRequests", parent: name, max: 25)
            try self.validate(self.dialRequests, name: "dialRequests", parent: name, min: 1)
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case dialRequests = "dialRequests"
        }
    }

    public struct PutDialRequestBatchResponse: AWSDecodableShape {
        public let failedRequests: [FailedRequest]?
        public let successfulRequests: [SuccessfulRequest]?

        @inlinable
        public init(failedRequests: [FailedRequest]? = nil, successfulRequests: [SuccessfulRequest]? = nil) {
            self.failedRequests = failedRequests
            self.successfulRequests = successfulRequests
        }

        private enum CodingKeys: String, CodingKey {
            case failedRequests = "failedRequests"
            case successfulRequests = "successfulRequests"
        }
    }

    public struct ResourceNotFoundException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct ResumeCampaignRequest: AWSEncodableShape {
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ServiceQuotaExceededException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct StartCampaignRequest: AWSEncodableShape {
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct StartInstanceOnboardingJobRequest: AWSEncodableShape {
        public let connectInstanceId: String
        public let encryptionConfig: EncryptionConfig

        @inlinable
        public init(connectInstanceId: String, encryptionConfig: EncryptionConfig) {
            self.connectInstanceId = connectInstanceId
            self.encryptionConfig = encryptionConfig
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.connectInstanceId, key: "connectInstanceId")
            try container.encode(self.encryptionConfig, forKey: .encryptionConfig)
        }

        public func validate(name: String) throws {
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, max: 256)
            try self.validate(self.connectInstanceId, name: "connectInstanceId", parent: name, pattern: "^[a-zA-Z0-9_\\-.]*$")
            try self.encryptionConfig.validate(name: "\(name).encryptionConfig")
        }

        private enum CodingKeys: String, CodingKey {
            case encryptionConfig = "encryptionConfig"
        }
    }

    public struct StartInstanceOnboardingJobResponse: AWSDecodableShape {
        public let connectInstanceOnboardingJobStatus: InstanceOnboardingJobStatus?

        @inlinable
        public init(connectInstanceOnboardingJobStatus: InstanceOnboardingJobStatus? = nil) {
            self.connectInstanceOnboardingJobStatus = connectInstanceOnboardingJobStatus
        }

        private enum CodingKeys: String, CodingKey {
            case connectInstanceOnboardingJobStatus = "connectInstanceOnboardingJobStatus"
        }
    }

    public struct StopCampaignRequest: AWSEncodableShape {
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct SuccessfulCampaignStateResponse: AWSDecodableShape {
        public let campaignId: String?
        public let state: CampaignState?

        @inlinable
        public init(campaignId: String? = nil, state: CampaignState? = nil) {
            self.campaignId = campaignId
            self.state = state
        }

        private enum CodingKeys: String, CodingKey {
            case campaignId = "campaignId"
            case state = "state"
        }
    }

    public struct SuccessfulRequest: AWSDecodableShape {
        public let clientToken: String?
        public let id: String?

        @inlinable
        public init(clientToken: String? = nil, id: String? = nil) {
            self.clientToken = clientToken
            self.id = id
        }

        private enum CodingKeys: String, CodingKey {
            case clientToken = "clientToken"
            case id = "id"
        }
    }

    public struct TagResourceRequest: AWSEncodableShape {
        public let arn: String
        public let tags: [String: String]

        @inlinable
        public init(arn: String, tags: [String: String]) {
            self.arn = arn
            self.tags = tags
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.arn, key: "arn")
            try container.encode(self.tags, forKey: .tags)
        }

        public func validate(name: String) throws {
            try self.validate(self.arn, name: "arn", parent: name, max: 500)
            try self.validate(self.arn, name: "arn", parent: name, min: 20)
            try self.validate(self.arn, name: "arn", parent: name, pattern: "^arn:.*$")
            try self.tags.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^(?!aws:)[a-zA-Z+-=._:/]+$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
            }
        }

        private enum CodingKeys: String, CodingKey {
            case tags = "tags"
        }
    }

    public struct ThrottlingException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct UntagResourceRequest: AWSEncodableShape {
        public let arn: String
        public let tagKeys: [String]

        @inlinable
        public init(arn: String, tagKeys: [String]) {
            self.arn = arn
            self.tagKeys = tagKeys
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.arn, key: "arn")
            request.encodeQuery(self.tagKeys, key: "tagKeys")
        }

        public func validate(name: String) throws {
            try self.validate(self.arn, name: "arn", parent: name, max: 500)
            try self.validate(self.arn, name: "arn", parent: name, min: 20)
            try self.validate(self.arn, name: "arn", parent: name, pattern: "^arn:.*$")
            try self.tagKeys.forEach {
                try validate($0, name: "tagKeys[]", parent: name, max: 128)
                try validate($0, name: "tagKeys[]", parent: name, min: 1)
                try validate($0, name: "tagKeys[]", parent: name, pattern: "^(?!aws:)[a-zA-Z+-=._:/]+$")
            }
            try self.validate(self.tagKeys, name: "tagKeys", parent: name, max: 50)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct UpdateCampaignDialerConfigRequest: AWSEncodableShape {
        public let dialerConfig: DialerConfig
        public let id: String

        @inlinable
        public init(dialerConfig: DialerConfig, id: String) {
            self.dialerConfig = dialerConfig
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            try container.encode(self.dialerConfig, forKey: .dialerConfig)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.dialerConfig.validate(name: "\(name).dialerConfig")
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case dialerConfig = "dialerConfig"
        }
    }

    public struct UpdateCampaignNameRequest: AWSEncodableShape {
        public let id: String
        public let name: String

        @inlinable
        public init(id: String, name: String) {
            self.id = id
            self.name = name
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.id, key: "id")
            try container.encode(self.name, forKey: .name)
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
            try self.validate(self.name, name: "name", parent: name, max: 127)
            try self.validate(self.name, name: "name", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case name = "name"
        }
    }

    public struct UpdateCampaignOutboundCallConfigRequest: AWSEncodableShape {
        public let answerMachineDetectionConfig: AnswerMachineDetectionConfig?
        public let connectContactFlowId: String?
        public let connectSourcePhoneNumber: String?
        public let id: String

        @inlinable
        public init(answerMachineDetectionConfig: AnswerMachineDetectionConfig? = nil, connectContactFlowId: String? = nil, connectSourcePhoneNumber: String? = nil, id: String) {
            self.answerMachineDetectionConfig = answerMachineDetectionConfig
            self.connectContactFlowId = connectContactFlowId
            self.connectSourcePhoneNumber = connectSourcePhoneNumber
            self.id = id
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            try container.encodeIfPresent(self.answerMachineDetectionConfig, forKey: .answerMachineDetectionConfig)
            try container.encodeIfPresent(self.connectContactFlowId, forKey: .connectContactFlowId)
            try container.encodeIfPresent(self.connectSourcePhoneNumber, forKey: .connectSourcePhoneNumber)
            request.encodePath(self.id, key: "id")
        }

        public func validate(name: String) throws {
            try self.validate(self.connectContactFlowId, name: "connectContactFlowId", parent: name, max: 500)
            try self.validate(self.connectSourcePhoneNumber, name: "connectSourcePhoneNumber", parent: name, max: 100)
            try self.validate(self.id, name: "id", parent: name, max: 256)
            try self.validate(self.id, name: "id", parent: name, pattern: "^[\\S]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case answerMachineDetectionConfig = "answerMachineDetectionConfig"
            case connectContactFlowId = "connectContactFlowId"
            case connectSourcePhoneNumber = "connectSourcePhoneNumber"
        }
    }

    public struct ValidationException: AWSErrorShape {
        public let message: String
        public let xAmzErrorType: String?

        @inlinable
        public init(message: String, xAmzErrorType: String? = nil) {
            self.message = message
            self.xAmzErrorType = xAmzErrorType
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.message = try container.decode(String.self, forKey: .message)
            self.xAmzErrorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }
}

// MARK: - Errors

/// Error enum for ConnectCampaigns
public struct ConnectCampaignsErrorType: AWSErrorType {
    enum Code: String {
        case accessDeniedException = "AccessDeniedException"
        case conflictException = "ConflictException"
        case internalServerException = "InternalServerException"
        case invalidCampaignStateException = "InvalidCampaignStateException"
        case invalidStateException = "InvalidStateException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case serviceQuotaExceededException = "ServiceQuotaExceededException"
        case throttlingException = "ThrottlingException"
        case validationException = "ValidationException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize ConnectCampaigns
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// You do not have sufficient access to perform this action.
    public static var accessDeniedException: Self { .init(.accessDeniedException) }
    /// The request could not be processed because of conflict in the current state of the resource.
    public static var conflictException: Self { .init(.conflictException) }
    /// Request processing failed because of an error or failure with the service.
    public static var internalServerException: Self { .init(.internalServerException) }
    /// The request could not be processed because of conflict in the current state of the campaign.
    public static var invalidCampaignStateException: Self { .init(.invalidCampaignStateException) }
    /// The request could not be processed because of conflict in the current state.
    public static var invalidStateException: Self { .init(.invalidStateException) }
    /// The specified resource was not found.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// Request would cause a service quota to be exceeded.
    public static var serviceQuotaExceededException: Self { .init(.serviceQuotaExceededException) }
    /// The request was denied due to request throttling.
    public static var throttlingException: Self { .init(.throttlingException) }
    /// The input fails to satisfy the constraints specified by an AWS service.
    public static var validationException: Self { .init(.validationException) }
}

extension ConnectCampaignsErrorType: AWSServiceErrorType {
    public static let errorCodeMap: [String: AWSErrorShape.Type] = [
        "AccessDeniedException": ConnectCampaigns.AccessDeniedException.self,
        "ConflictException": ConnectCampaigns.ConflictException.self,
        "InternalServerException": ConnectCampaigns.InternalServerException.self,
        "InvalidCampaignStateException": ConnectCampaigns.InvalidCampaignStateException.self,
        "InvalidStateException": ConnectCampaigns.InvalidStateException.self,
        "ResourceNotFoundException": ConnectCampaigns.ResourceNotFoundException.self,
        "ServiceQuotaExceededException": ConnectCampaigns.ServiceQuotaExceededException.self,
        "ThrottlingException": ConnectCampaigns.ThrottlingException.self,
        "ValidationException": ConnectCampaigns.ValidationException.self
    ]
}

extension ConnectCampaignsErrorType: Equatable {
    public static func == (lhs: ConnectCampaignsErrorType, rhs: ConnectCampaignsErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension ConnectCampaignsErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
